package com.jsgt.greekfire.bean

import android.os.Parcel
import android.os.Parcelable

class AtrAccountInfoBean() :Parcelable {
    var address: String? = null
    var balance: String? = null
    var net_usage: String? = null
    var create_time: String? = null
    var latest_opration_time: String? = null
    var free_net_usage: String? = null
    var latest_consume_time: String? = null
    var latest_consume_free_time: String? = null
    var account_resource: AccountResourceBean? = null
    var owner_permission: OwnerPermissionBean? = null
    var votes: List<VotesBean>? = null
    var frozen: List<FrozenBean>? = null
    var active_permission: List<ActivePermissionBean>? = null
    var delegate: List<DelegateBean>? = null
    var delegate_frozen: String? = null

    constructor(parcel: Parcel) : this() {
        address = parcel.readString()
        balance = parcel.readString()
        net_usage = parcel.readString()
        create_time = parcel.readString()
        latest_opration_time = parcel.readString()
        free_net_usage = parcel.readString()
        latest_consume_time = parcel.readString()
        latest_consume_free_time = parcel.readString()
        account_resource = parcel.readParcelable(AccountResourceBean::class.java.classLoader)
        owner_permission = parcel.readParcelable(OwnerPermissionBean::class.java.classLoader)
        votes = parcel.createTypedArrayList(VotesBean)
        frozen = parcel.createTypedArrayList(FrozenBean)
        active_permission = parcel.createTypedArrayList(ActivePermissionBean)
        delegate = parcel.createTypedArrayList(DelegateBean)
        delegate_frozen = parcel.readString()
    }

    class DelegateBean() :Parcelable {

        var delegate_address: String? = null
        var delegate_count: String? = null
        var owner_address: String? = null
        var rank: String? = null
        var timestamp: String? = null

        constructor(parcel: Parcel) : this() {
            delegate_address = parcel.readString()
            delegate_count = parcel.readString()
            owner_address = parcel.readString()
            rank = parcel.readString()
            timestamp = parcel.readString()
        }

        override fun writeToParcel(parcel: Parcel, flags: Int) {
            parcel.writeString(delegate_address)
            parcel.writeString(delegate_count)
            parcel.writeString(owner_address)
            parcel.writeString(rank)
            parcel.writeString(timestamp)
        }

        override fun describeContents(): Int {
            return 0
        }

        companion object CREATOR : Parcelable.Creator<DelegateBean> {
            override fun createFromParcel(parcel: Parcel): DelegateBean {
                return DelegateBean(parcel)
            }

            override fun newArray(size: Int): Array<DelegateBean?> {
                return arrayOfNulls(size)
            }
        }
    }


    class AccountResourceBean() :Parcelable {
        constructor(parcel: Parcel) : this() {
        }

        override fun writeToParcel(parcel: Parcel, flags: Int) {

        }

        override fun describeContents(): Int {
            return 0
        }

        companion object CREATOR : Parcelable.Creator<AccountResourceBean> {
            override fun createFromParcel(parcel: Parcel): AccountResourceBean {
                return AccountResourceBean(parcel)
            }

            override fun newArray(size: Int): Array<AccountResourceBean?> {
                return arrayOfNulls(size)
            }
        }
    }

    class OwnerPermissionBean() :Parcelable{
        /**
         * permission_name : owner
         * threshold : 1
         * keys : [{"address":"TDwmBHB6DcQrMSwRAUj9xYZDRG2epuRPyN","weight":1}]
         */
        var permission_name: String? = null
        var threshold: String? = null
        var keys: List<KeysBean>? = null

        constructor(parcel: Parcel) : this() {
            permission_name = parcel.readString()
            threshold = parcel.readString()
        }

        class KeysBean {
            /**
             * address : TDwmBHB6DcQrMSwRAUj9xYZDRG2epuRPyN
             * weight : 1
             */
            var address: String? = null
            var weight: String? = null
        }

        override fun writeToParcel(parcel: Parcel, flags: Int) {
            parcel.writeString(permission_name)
            parcel.writeString(threshold)
        }

        override fun describeContents(): Int {
            return 0
        }

        companion object CREATOR : Parcelable.Creator<OwnerPermissionBean> {
            override fun createFromParcel(parcel: Parcel): OwnerPermissionBean {
                return OwnerPermissionBean(parcel)
            }

            override fun newArray(size: Int): Array<OwnerPermissionBean?> {
                return arrayOfNulls(size)
            }
        }
    }

    class VotesBean() :Parcelable {
        /**
         * vote_address : TKFgZSa5Qc3aegpGN6uAN8Yhs328yFSq5X
         * vote_count : 20
         */
        var vote_address: String? = null
        var vote_count: String? = null

        constructor(parcel: Parcel) : this() {
            vote_address = parcel.readString()
            vote_count = parcel.readString()
        }

        override fun writeToParcel(parcel: Parcel, flags: Int) {
            parcel.writeString(vote_address)
            parcel.writeString(vote_count)
        }

        override fun describeContents(): Int {
            return 0
        }

        companion object CREATOR : Parcelable.Creator<VotesBean> {
            override fun createFromParcel(parcel: Parcel): VotesBean {
                return VotesBean(parcel)
            }

            override fun newArray(size: Int): Array<VotesBean?> {
                return arrayOfNulls(size)
            }
        }
    }

    class FrozenBean() :Parcelable {
        /**
         * frozen_balance : 20000000
         * expire_time : 1601167725000
         */
        var frozen_balance: String? = null
        var expire_time: String? = null

        constructor(parcel: Parcel) : this() {
            frozen_balance = parcel.readString()
            expire_time = parcel.readString()
        }

        override fun writeToParcel(parcel: Parcel, flags: Int) {
            parcel.writeString(frozen_balance)
            parcel.writeString(expire_time)
        }

        override fun describeContents(): Int {
            return 0
        }

        companion object CREATOR : Parcelable.Creator<FrozenBean> {
            override fun createFromParcel(parcel: Parcel): FrozenBean {
                return FrozenBean(parcel)
            }

            override fun newArray(size: Int): Array<FrozenBean?> {
                return arrayOfNulls(size)
            }
        }
    }

    class ActivePermissionBean() :Parcelable {
        /**
         * type : Active
         * id : 2
         * permission_name : active
         * threshold : 1
         * operations : 7fff1fc0033e0100000000000000000000000000000000000000000000000000
         * keys : [{"address":"TDwmBHB6DcQrMSwRAUj9xYZDRG2epuRPyN","weight":1}]
         */
        var type: String? = null
        var id = 0
        var permission_name: String? = null
        var threshold: String? = null
        var operations: String? = null
        var keys: List<KeysBean>? = null

        constructor(parcel: Parcel) : this() {
            type = parcel.readString()
            id = parcel.readInt()
            permission_name = parcel.readString()
            threshold = parcel.readString()
            operations = parcel.readString()
        }

        class KeysBean {
            /**
             * address : TDwmBHB6DcQrMSwRAUj9xYZDRG2epuRPyN
             * weight : 1
             */
            var address: String? = null
            var weight: String? = null
        }

        override fun writeToParcel(parcel: Parcel, flags: Int) {
            parcel.writeString(type)
            parcel.writeInt(id)
            parcel.writeString(permission_name)
            parcel.writeString(threshold)
            parcel.writeString(operations)
        }

        override fun describeContents(): Int {
            return 0
        }

        companion object CREATOR : Parcelable.Creator<ActivePermissionBean> {
            override fun createFromParcel(parcel: Parcel): ActivePermissionBean {
                return ActivePermissionBean(parcel)
            }

            override fun newArray(size: Int): Array<ActivePermissionBean?> {
                return arrayOfNulls(size)
            }
        }
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(address)
        parcel.writeString(balance)
        parcel.writeString(net_usage)
        parcel.writeString(create_time)
        parcel.writeString(latest_opration_time)
        parcel.writeString(free_net_usage)
        parcel.writeString(latest_consume_time)
        parcel.writeString(latest_consume_free_time)
        parcel.writeParcelable(account_resource, flags)
        parcel.writeParcelable(owner_permission, flags)
        parcel.writeTypedList(votes)
        parcel.writeTypedList(frozen)
        parcel.writeTypedList(active_permission)
        parcel.writeTypedList(delegate)
        parcel.writeString(delegate_frozen)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<AtrAccountInfoBean> {
        override fun createFromParcel(parcel: Parcel): AtrAccountInfoBean {
            return AtrAccountInfoBean(parcel)
        }

        override fun newArray(size: Int): Array<AtrAccountInfoBean?> {
            return arrayOfNulls(size)
        }
    }
}